<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var money = 5000
    while(true){
        var num = +prompt(`欢迎使用ATM
        1.存款
        2.取款
        3,查询余额
        4.退出`)
        if(num ===4){
            break
        }else if(num === 1){
            var cunQ = +prompt(`请输入您需要存款的金额`)
            money += cunQ
        }else if(num === 2){
            var quQ = +prompt(`请输入您需要取款的金额`)
            money -= quQ
        }else if(num == 3){
            alert(`您所剩余额为:${money}元`)
        }else{
            alert(`请输入以上选项`)
        }
    }


    var money = 5000
    while(true){
        var num = +prompt(`欢迎使用ATM
        1.存款
        2.取款
        3,查询余额
        4.退出`)
        switch (num) {
            case 4:
                break;
            case 1:
            var cunQ = +prompt(`请输入您需要存款的金额`)
            money += cunQ
            break
            case 2:
            var quQ = +prompt(`请输入您需要取款的金额`)
            money -= quQ
            break
            case 3:
            alert(`您所剩余额为:${money}元`)
            break
            default:
            alert(`请输入以上选项`)
                break;
        }
        if(num === 4){
            break
        }
    }
</script>
</html>